<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>WIKINDX CLASS DOCUMENTATION</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="/wikindx2/docs/docs.css" type="text/css" />
</head>

<body bgcolor="#FFFFFF" text="#000000">
<h2>WIKINDX METHODS</h2>
<p><strong>Method:</strong><br />
  
  selectWithExceptions()
</p>
<p><strong>Class:</strong><br />

  <a href="sqlClass.html">SQL</a>
<p><strong>Method Call:</strong><br />
  include_once("core/sql/SQL.php");<br />
$db = new SQL();<br />
ADODB_RECORDSET $db->selectWithExceptions(ARRAY: $tables, ARRAY: $fields, [STRING: $condition]); </p>
<p><strong>Description:</strong><br />
  
Execute a SELECT statement.  If $fields contains an associative array (or arrays), then that inner array is treated as an alias and is 
parsed by <a href="formataliasMethod.html">formatAlias()</a>. In this case, <a href="formataliasMethod.html">formatAlias()</a> will scan for special strings and, if found, will not add backticks to the field name. It is used when a key in a $fields associative array is not a table field name but is actually a SQL function call. See the example below. </p>
<p>Do not add backticks, single-quotes etc. - the SQL class will do this automatically depending on the database we're 
    connected to as long as $fields is an ARRAY.</p>
<p>The return is an ADODB_RECORDSET suitable for passing to the <a href="fetchRowMethod.html">fetchRow()</a>, <a href="loopRecordSetMethod.html">loopRecordSet()</a> or <a href="fetchOneMethod.html">fetchOne()</a> methods etc. If it fails to execute the query, the script will exit with an error message.</p>
<p>Currently, the single exception is SQL's DATE_FORMAT function. Developers should edit ADODB::formatAliasWithExceptions() method to add more exceptions then edit this document. </p>
<p><strong>Usage:</strong><br />
For example (assuming the database object exists within a class as $this->db):</p>
<pre>
	$recordset = $this->db->selectWithExceptions(array("WKX_news"), array(
			array($this->db->db->SQLDate('d/M/Y', 'timestamp') => 'timestamp'), 'title', 'news'), 
			'WHERE ' . $this->db->formatField('id') . '=' . $this->db->tidyInput('1'));
	$row = $this->db->fetchRow($recordset);</pre>	

In the above example the SELECT statement as formatted by selectWithExceptions() before internally passing to <a href="queryMethod.html">query()</a> will be:
<pre>
	SELECT DATE_FORMAT(timestamp,'%d/%b/%Y') AS `timestamp`, `title`, `news` FROM `WKX_news` WHERE `id`='1';
</pre>
<p>
The SQLDate() function is internal to ADOdb.
</p>
<p align="right"><a href="../../index.html">WIKINDX home</a>
&nbsp;&nbsp;&nbsp;&nbsp;
<a href="../../usage/index.html">WIKINDX usage</a>
&nbsp;&nbsp;&nbsp;&nbsp;
<a href="../index.html">WIKINDX classes</a>
</p>
</body>

</html>
